//École de Technologie Supérieure (ÉTS)
//LOG720 - Laboratoire 3  - Intégration de Spring + Hibernate
//Date de remise: 2011-12-13
//Auteurs:
//Jonathan Aubuchon (AUBJ18038704)
//Jeff Grenier (GREJ02098703)
//Francis Paré (PARF21038708)


package springapp.domain;

import java.util.ArrayList;
import java.util.List;

/***
 * Dossier
 * Impl�mentation d'un dossier criminel
 */
public class Dossier implements java.io.Serializable{

	private int id;
	private String nom;
	private String prenom;
	private String noPermis;
	private String noPlaque;
	//Repr�sente le niveau de gravit� de l'infraction la plus grave au dossier
	private int maxNiveau;
	
	private List<Infraction> infractions = new ArrayList<Infraction>();
	
	public Dossier(){
		
	}
	public Dossier(int id, String nom, String prenom, String noPermis, String noPlaque){
		this.id = id;
		this.nom = nom;
		this.prenom = prenom;
		this.noPermis = noPermis;
		this.noPlaque = noPlaque;
		this.maxNiveau = 0;
	}
	
	
	public String getString(){
		return "Dossier ID:"+id+", de " + prenom+" " + nom+
				", plaque:" + noPlaque+", permis:"+noPermis+
				". (niveau max:"+maxNiveau+")";
	}
	
	public int getId(){
		return this.id;
	}
	public String getNom(){
		return this.nom;
	}
	public String getPrenom(){
		return this.prenom;
	}
	public String getNoPermis(){
		return this.noPermis;
	}
	public String getNoPlaque(){
		return this.noPlaque;
	}
	public int getNiveauGraviteMax(){
		int niveauMax = -1;
		
		for(Infraction i : infractions){
			if(i.getNiveau()>niveauMax)
				niveauMax = i.getNiveau();
		}
		return niveauMax;
	}
	public List<Infraction> getInfractions(){
		return this.infractions;
	}
	
	public void setId(int _id) {
		this.id = _id;
	}
	public void setNom(String _nom) {
		this.nom = _nom;
	}
	public void setPrenom(String _prenom) {
		this.prenom = _prenom;
	}
	public void setNoPermis(String _noPermis) {
		this.noPermis = _noPermis;
	}
	public void setNoPlaque(String _noPlaque) {
		this.noPlaque = _noPlaque;
	}
	public void setInfractions(List<Infraction> infractions){
		this.infractions = infractions;
	}
	public void addInfraction(Infraction inf){
		this.getInfractions().add(inf);
	}
}
